-- Script n°012:
-- > Drop the column "camera" on the table "photo".
-- > Add the constraints (unicity and foreign key) on the column "cameramodelid".

BEGIN;

-- Drop the column "camera".
ALTER TABLE photo DROP COLUMN camera;

-- Add the constraints on the column "cameramodelid".
ALTER TABLE photo ALTER COLUMN cameramodelid SET NOT NULL;

ALTER TABLE photo
   ADD CONSTRAINT fk_photo_cameramodel FOREIGN KEY (cameramodelid)
      REFERENCES cameramodel (id)
      ON DELETE RESTRICT ON UPDATE RESTRICT;

END;